{include file="public/head" /}
<!--有理想的地方，地狱都是天堂-->
<!--Copyright @ df81.com 版权所有-->
<!--作者: 南国老符 邮箱：1062129401@qq.com-->
<link href="{:config('template.skin')}/bootstrap-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet" type="text/css" />
        <!-- 左侧菜单 开始 -->
        <div class="sidebar">
            <nav>
                <ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-legacy d-block d-md-none" data-widget="treeview" role="menu" data-accordion="false">
                    {include file="public/left_content" /}
                </ul>
                <ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-legacy d-block d-md-none" data-widget="treeview" role="menu" data-accordion="false">
                    {include file="public/left_data" /}
                </ul>
                <ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-legacy" data-widget="treeview" role="menu" data-accordion="false">
                    {include file="public/left_global" /}
                </ul>
                <ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-legacy d-block d-md-none" data-widget="treeview" role="menu" data-accordion="false">
                    {include file="public/left_system" /}
                </ul>
            </nav>
        </div>
        <!-- 左侧菜单 结束 -->
    </aside>
    <!-- 左侧 结束 -->
    <!-- 右侧 开始 -->
    <div class="content-wrapper">
        <!-- 内容导航 开始 -->
        <div class="content-header py-2 bg-white mb-3">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-sm-12">
                        <ol class="breadcrumb">
                            <li>{:lang('v_global')}<i class="fas fa-angle-right mx-2"></i></li>
                            <li>{:lang('v_system_manage')}<i class="fas fa-angle-right mx-2"></i></li>
                            <li>{:lang('v_authgroup')} {:lang('v_manage')}<i class="fas fa-angle-right mx-2"></i></li>
                            <li>{eq name="rs.id" value=""}{:lang('v_add')}{else /}{:lang('v_edit')}{/eq} {:lang('v_authgroup')}</li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
        <!-- 内容导航 结束 -->
        <!-- 内容主体 开始 -->
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-md-12">
                        <div class="w-100 py-3 bg-white rounded mb-3">
                            <div class="row">
                                <div class="col-md-12">
                                    <a class="btn btn-default mr-2" href="{:url('/auth_group/index',['lang'=>input('lang')])}"><i class="fa fa-fw fa-users mr-1"></i>{:lang('v_authgroup')} {:lang('v_manage')}</a>
                                    <a class="btn btn-success" href="{:url('/auth_group/edit',['lang'=>input('lang')])}"><i class="fa fa-fw fa-plus-circle mr-1"></i>{eq name="rs.id" value=""}{:lang('v_add')}{else /}{:lang('v_edit')}{/eq} {:lang('v_authgroup')}</a>
                                </div>
                            </div>
                        </div>
                        <div class="card card-outline card-success">
                            <div class="card-header"><i class="fas fa-cog mr-1"></i>{:lang('v_basic')} {:lang('v_setting')}</div>
                            <div class="card-body">
                                <form name="form_edit" id="form_edit" method="post" action="{:url('/auth_group/edit',['lang'=>$lang])}">
                                    <input type="hidden" name="id" value="{$rs.id}">
                                    <input type="hidden" name="lang" value="{:input('lang')}">
                                    <div class="w-100">
                                        <table class="table mb-0">
                                            <tr>
                                                <td class="p-2 border-top-0" width="180">{:lang('v_authgroup')} {:lang('v_name')}：</td>
                                                <td class="p-2 border-top-0">
                                                    <div class="col-md-4">
                                                        <input type="text" class="form-control" name="title" value="{$rs.title}" />
                                                        <div id="title_tips" class="text-0"></div>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr class="d-none">
                                                <td class="p-2">{:lang('v_belong')} {:lang('v_authgroup')}：</td>
                                                <td class="p-2">
                                                    <div class="col-md-4">
                                                        <select name="parentid" class="form-control">                                        
                                                            <option value="0">{:lang('v_top_authgroup')}</option>
                                                            {foreach name="authGroup" item="v"}
                                                                {neq name="v.id" value="$rs.id"}
                                                                    <option value="{$v.id}" {eq name="rs.parentid" value="$v.id"}selected="selected"{/eq}>{$v.html} {$v.title}</option>
                                                                {/neq}
                                                            {/foreach}
                                                        </select>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr class="{if session('is_admin') eq 9 and $rs.is_admin eq session('is_admin')}d-none{/if}">
                                                <td class="p-2" width="180">{:lang('v_user')} {:lang('v_type')}：</td>
                                                <td class="p-2">
                                                    <div class="col-md-12">
                                                        <label class="form-check form-check-inline">
                                                            <input type="radio" name="is_admin" value="0"{eq name="rs.is_admin" value="0"} checked="checked"{/eq} class="form-check-input" /> {:lang('g_front')} {:lang('v_user')}
                                                        </label>
                                                        <label class="form-check form-check-inline">
                                                            <input type="radio" name="is_admin" value="1"{eq name="rs.is_admin" value="1"} checked="checked"{/eq} class="form-check-input" />{:lang('g_system')} {:lang('g_admin')}
                                                        </label>
                                                        <label class="form-check form-check-inline d-none">
                                                            <input type="radio" name="is_admin" value="2"{eq name="rs.is_admin" value="2"} checked="checked"{/eq} class="form-check-input" />{:lang('g_supplier')}
                                                        </label>
                                                        <label class="form-check form-check-inline d-none">
                                                            <input type="radio" name="is_admin" value="3"{eq name="rs.is_admin" value="3"} checked="checked"{/eq} class="form-check-input" />{:lang('g_no_access')}
                                                        </label>
                                                        <label class="form-check form-check-inline">
                                                            <input type="radio" name="is_admin" value="9"{if $rs.is_admin eq 9 or empty($rs.id)} checked="checked"{/if} class="form-check-input" />{:lang('g_super')} {:lang('g_admin')}<span class="text-0 bold">（{:lang('g_all_auth')}）</span>
                                                        </label>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr class="{if in_array($rs.is_admin,array(0,9))}d-none{/if}" id="rule_value">
                                                <td class="p-2">{:lang('v_authrule')} {:lang('v_value')}：</td>
                                                <td class="p-2">
                                                    <div class="col-md-12"><div id="getrule"></div></div>
                                                </td>
                                            </tr>
                                            <tr class="d-none">
                                                <td class="p-2">{:lang('g_grade')} {:lang('g_must_know')}：</td>
                                                <td class="p-2">
                                                    <div class="col-md-4"><textarea name="note" rows="3" class="form-control">{$rs.note}</textarea></div>
                                                </td>
                                            </tr>
                                            <tr class="d-none">
                                                <td class="p-2">{:lang('g_upgrade')} {:lang('v_method')}：</td>
                                                <td class="p-2">
                                                    <div class="col-md-4">
                                                        <label class="form-check form-check-inline text-danger">
                                                            <input type="checkbox" name="upgrade[]" value="0" {if in_array('0',$upgrade_arr)}checked="checked"{/if} class="form-check-input">{:lang('g_buy')} {:lang('g_upgrade')}
                                                        </label>
                                                        <label class="form-check form-check-inline text-success">
                                                            <input type="checkbox" name="upgrade[]" value="1" {if in_array('1',$upgrade_arr)}checked="checked"{/if} class="form-check-input">{:lang('g_total_consume')} {:lang('g_upgrade')}
                                                        </label>
                                                        <div id="upgrade_tips" class="text-0"></div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div class="w-100 upgrade_0 text-0 d-none">
                                        <table class="table mb-0 {if config('app.other.system_type') eq 'company'}d-none{/if}">
                                            <tr>
                                                <td class="p-2" width="180">{:lang('g_maket_price')}：</td>
                                                <td class="p-2">
                                                    <div class="col-md-4">
                                                        <div class="input-group">
                                                            <input name="original_price" id="original_price" type="number" class="form-control" value="{empty name="rs.id"}5000{else /}{$rs.original_price}{/empty}" onblur="javascript:upgrade_vad('#original_price','#original_price_tips',10,1000000000,'price');" />
                                                            <span class="input-group-append">
                                                                <button type="submit" class="btn btn-default">{:lang('shopv_dollar')}</button>
                                                            </span>
                                                        </div>
                                                        <div id="original_price_tips"></div>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="p-2">{:lang('g_price')}：</td>
                                                <td class="p-2">
                                                    <div class="col-md-4">
                                                        <div class="input-group">
                                                            <input name="current_price" id="current_price" type="number" class="form-control" value="{empty name="rs.id"}2000{else /}{$rs.current_price}{/empty}" onblur="javascript:upgrade_vad('#current_price','#current_price_tips',10,1000000000,'price');" />
                                                            <span class="input-group-append">
                                                                <button type="submit" class="btn btn-default">{:lang('shopv_dollar')}</button>
                                                            </span>
                                                        </div>
                                                        <div id="current_price_tips"></div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div class="w-100 upgrade_1 text-success {if !in_array('1',$upgrade_arr)}d-none{/if} {if config('app.other.system_type') eq 'company'}d-none{/if}">
                                        <table class="table mb-0 {if config('app.other.system_type') eq 'company'}d-none{/if}">
                                            <tr>
                                                <td class="p-2" width="180">{:lang('g_total_consume')}（{:lang('shopv_amount')}）：</td>
                                                <td class="p-2">
                                                    <div class="col-md-4">
                                                        <div class="input-group">
                                                            <input name="consume_price" id="consume_price" type="number" class="form-control" value="{empty name="rs.id"}10000{else /}{$rs.consume_price}{/empty}" onblur="javascript:upgrade_vad('#consume_price','#consume_price_tips',10,1000000000,'price');" />
                                                            <span class="input-group-append">
                                                                <span class="btn btn-default">{:lang('shopv_dollar')}</span>
                                                            </span>
                                                        </div>
                                                        <div id="consume_price_tips" class="text-0"></div>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="p-2">{:lang('g_total_consume')}（{:lang('shopv_score')}）：</td>
                                                <td class="p-2">
                                                    <div class="col-md-4">
                                                        <div class="input-group">
                                                            <input name="consume_score" id="consume_score" type="number" class="form-control" value="{empty name="rs.id"}20000{else /}{$rs.consume_score}{/empty}" onblur="javascript:upgrade_vad('#consume_score','#consume_score_tips',10,1000000000,'int');" />
                                                            <span class="input-group-append">
                                                                <span class="btn btn-default">{:lang('shopv_score')}</span>
                                                            </span>
                                                        </div>
                                                        <div id="consume_score_tips" class="text-0"></div>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="p-2">{:lang('g_total_consume')}（{:lang('g_bi')}）：</td>
                                                <td class="p-2">
                                                    <div class="col-md-4">
                                                        <div class="input-group">
                                                            <input name="consume_times" id="consume_times" type="number" class="form-control" value="{empty name="rs.id"}1000{else /}{$rs.consume_times}{/empty}" onblur="javascript:upgrade_vad('#consume_times','#consume_times_tips',10,1000000000,'int');" />
                                                            <span class="input-group-append">
                                                                <span class="btn btn-default">{:lang('g_bi')}</span>
                                                            </span>
                                                        </div>
                                                        <div id="consume_times_tips" class="text-0"></div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div class="form-group d-none" id="close_time">
                                        <div class="w-100">
                                            <table class="table mb-0 {if config('app.other.system_type') eq 'company'}d-none{/if}">
                                                <tr>
                                                    <td class="p-2" width="180">{:lang('g_expire')} {:lang('v_time')} ：</td>
                                                    <td class="p-2">
                                                        <div class="col-md-4">
                                                            <div class="input-group date form_date">
                                                                <input name="close_time" type="text" readonly="readonly" class="form-control" value="{$close_time}" />
                                                                <span class="input-group-append">
                                                                    <span class="btn btn-default date-set"><i class="fa fa-calendar-alt"></i></span>
                                                                </span>
                                                            </div>
                                                        </div>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="p-2" width="180">{:lang('v_sequence')}：</td>
                                                    <td class="p-2">
                                                        <div class="col-md-4">
                                                            <input type="number" class="form-control" name="sequence" value="{$rs.sequence}" maxlength="10" />
                                                        </div>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="col-md-12 py-2 mb-2 bg-light d-none"><span class="text-danger font-weight-bold"><i class="fa fa-flag mr-2"></i>{:lang('g_grade')} {:lang('g_equity')}</span></div>
                                    <div class="w-100">
                                        <table class="table mb-0 {if config('app.other.system_type') eq 'company'}d-none{/if}">
                                            {volist name="module_list" id="moduleRs"}
                                                {php}$discount_rate = 100;{/php}
                                                {notempty name="discount_rs_arr"}
                                                    {foreach $discount_rs_arr as $discount_rs}
                                                        {php}$discount_arr = explode(':',$discount_rs);{/php}
                                                        {if $moduleRs.tabledir eq $discount_arr[0]}
                                                            {php}$discount_rate = $discount_arr[1];{/php}
                                                        {/if}
                                                    {/foreach}
                                                {/notempty}
                                                <tr>
                                                    <td class="p-2 border-top-0" width="180">{$moduleRs.title} {:lang('g_discount_rate')}：</td>
                                                    <td class="p-2 border-top-0">
                                                        <div class="col-md-4">
                                                            <div class="input-group">
                                                                <input name="discount_rate[]" id="discount{$key}" type="number" class="form-control" value="{$discount_rate}" onblur="javascript:upgrade_vad('#discount{$key}','#discount_tips{$key}',10,100,'price');" />
                                                                <span class="input-group-append">
                                                                    <span class="btn btn-default">%</span>
                                                                </span>
                                                            </div>
                                                            <div id="discount_tips{$key}" class="text-0"></div>
                                                            <input type="hidden" name="discount_tabledir[]" value="{$moduleRs.tabledir}">
                                                        </div>
                                                    </td>
                                                </tr>
                                            {/volist}
                                            <input type="hidden" name="discount" value="{$rs.discount}">
                                        </table>
                                    </div>
                                    <div class="col-md-12 py-2 mb-2 bg-light d-none"><span class="text-danger font-weight-bold"><i class="fa fa-gift mr-2"></i>{:lang('g_upgrade')} {:lang('g_gift')}</span></div>
                                    <div class="w-100">
                                        <table class="table mb-0 d-none">
                                            <tr>
                                                <td class="p-2 border-top-0" width="180">{:lang('g_upgrade')} {:lang('g_give')} {:lang('shopv_score')}：</td>
                                                <td class="p-2 border-top-0">
                                                    <div class="col-md-4">
                                                        <div class="input-group">
                                                            <input name="give_score" id="give_score" type="number" class="form-control" value="{empty name="rs.id"}0{else /}{$rs.give_score}{/empty}" onblur="javascript:upgrade_vad('#give_score','#give_score_tips',10,1000000000,'int');" />
                                                            <span class="input-group-append">
                                                                <span class="btn btn-default">{:lang('shopv_score')}</span>
                                                            </span>
                                                        </div>
                                                        <div id="give_score_tips" class="text-0"></div>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="p-2">{:lang('g_upgrade')} {:lang('g_give')} {:lang('shopv_balance')}：</td>
                                                <td class="p-2">
                                                    <div class="col-md-4">
                                                        <div class="input-group">
                                                            <input name="give_price" id="give_price" type="number" class="form-control" value="{empty name="rs.id"}0{else /}{$rs.give_price}{/empty}" onblur="javascript:upgrade_vad('#give_price','#give_price_tips',10,1000000000,'price');" />
                                                            <span class="input-group-append">
                                                                <span class="btn btn-default">{:lang('shopv_dollar')}</span>
                                                            </span>
                                                        </div>
                                                        <div id="give_price_tips" class="text-0"></div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div class="col-md-12 py-2 mb-2 bg-light d-none"><span class="text-danger font-weight-bold"><i class="fa fa-sitemap mr-2"></i>{:lang('g_third_grade')} {:lang('shopv_distribution')}</span></div>
                                    <div class="w-100">
                                        <table class="table mb-0 d-none">
                                            <tr>
                                                <td class="p-2" width="180">{:lang('v_enable_ornot')} {:lang('shopv_distribution')}：</td>
                                                <td class="p-2">
                                                    <div class="col-md-4 radio">
                                                        <label class="mr-2">
                                                            <input type="radio" name="is_distributor" value="0"{empty name="rs.is_distributor"} checked="checked"{/empty} /> {:lang('v_no')}
                                                        </label>
                                                        <label class="ml-2">
                                                            <input type="radio" name="is_distributor" value="1"{eq name="rs.is_distributor" value="1"} checked="checked"{/eq} />{:lang('v_yes')}
                                                        </label>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="p-2 border-top-0" width="180">{:lang('g_first_commission_rate')}：</td>
                                                <td class="p-2 border-top-0">
                                                    <div class="col-md-4">
                                                        <div class="input-group">
                                                            <input name="level_1" id="level_1" type="number" class="form-control" value="{empty name="rs.id"}60{else /}{$rs.level_1}{/empty}" onblur="javascript:upgrade_vad('#level_1','#level_1_tips',10,100,'price');" />
                                                            <span class="input-group-append">
                                                                <button type="submit" class="btn btn-default">%</button>
                                                            </span>
                                                        </div>
                                                        <div id="level_1_tips" class="text-0"></div>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="p-2">{:lang('g_second_commission_rate')}：</td>
                                                <td class="p-2">
                                                    <div class="col-md-4">
                                                        <div class="input-group">
                                                            <input name="level_2" id="level_2" type="number" class="form-control" value="{empty name="rs.id"}30{else /}{$rs.level_2}{/empty}" onblur="javascript:upgrade_vad('#level_2','#level_2_tips',10,100,'price');" />
                                                            <span class="input-group-append">
                                                                <button type="submit" class="btn btn-default">%</button>
                                                            </span>
                                                        </div>
                                                        <div id="level_2_tips" class="text-0"></div>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="p-2">{:lang('g_third_commission_rate')}：</td>
                                                <td class="p-2">
                                                    <div class="col-md-4">
                                                        <div class="input-group">
                                                            <input name="level_3" id="level_3" type="number" class="form-control" value="{empty name="rs.id"}10{else /}{$rs.level_3}{/empty}" onblur="javascript:upgrade_vad('#level_3','#level_3_tips',10,100,'price');" />
                                                            <span class="input-group-append">
                                                                <button type="submit" class="btn btn-default">%</button>
                                                            </span>
                                                        </div>
                                                        <div id="level_3_tips" class="text-0"></div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div class="form-group">
                                        <table class="table mb-0">
                                            <tr>
                                                <td width="180"></td>
                                                <td class="p-2">
                                                    <div class="col-md-4 mt-2">
                                                        {if is_file(app()->getRootPath().'.env')}
                                                            <button type="submit" class="do_ajax btn btn-success mr-4"><i class="fas fa-check-circle mr-2"></i>{:lang('v_save')}</button>
                                                        {else /}
                                                            <button type="button" class="do_ajax btn btn-success mr-4" onclick="javascript:do_ajax('#form_edit','.do_ajax','{:url('/auth_group/edit',['lang'=>$lang])}','{:url('/auth_group/index',['lang'=>$lang])}');"><i class="fa fa-fw fa-check-circle mr-2"></i>{:lang('v_save')}</button>
                                                        {/if}
                                                        <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);"><i class="fa fa-angle-double-left mr-1"></i>{:lang('v_goback')}</button>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!-- 内容主体 结束 -->
    </div>
    <!-- 右侧 结束 -->
{include file="public/foot" /}
{include file="public/js_date_picker" /}
{include file="public/js_auth_group_edit" /}
</body>
</html>